home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / udpcmd.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-10  |  1.0 KB  |  56 lines

  1. /* UDP-related user commands
  2.  * Copyright 1991 Phil Karn, KA9Q
  3.  */
  4. #include <stdio.h>
  5. #include "global.h"
  6. #include "mbuf.h"
  7. #include "netuser.h"
  8. #include "udp.h"
  9. #include "internet.h"
  10. #include "cmdparse.h"
  11. #include "commands.h"
  12.  
  13. int
  14. st_udp(udp)
  15. struct udp_cb *udp;
  16. {
  17.     return tprintf("%8lx%6u  %s\n",ptol(udp),udp->rcvcnt,pinet(&udp->socket));
  18. }
  19.  
  20. /* Dump UDP statistics and control blocks */
  21. static int
  22. doudpstat(argc,argv,p)
  23. int argc;
  24. char *argv[];
  25. void *p;
  26. {
  27.     struct udp_cb *udp;
  28.     int i;
  29.  
  30.     for(i = 1; i <= NUMUDPMIB; i++) {
  31.         tprintf("(%2u)udp%-17s%10lu",i,Udp_mib[i].name,Udp_mib[i].value.integer);
  32.         tputs((i % 2) ? "     " : "\n");
  33.     }
  34.     if((i % 2) == 0)
  35.         tputs("\n");
  36.  
  37.     tputs("&UCB     Rcv-Q  Local socket\n");
  38.     for(udp = Udps;udp != NULLUDP; udp = udp->next)
  39.         st_udp(udp);
  40.  
  41.     return 0;
  42. }
  43.  
  44. int
  45. doudp(argc,argv,p)
  46. int argc;
  47. char *argv[];
  48. void *p;
  49. {
  50.     struct cmds Udpcmds[] = {
  51.         "status",    doudpstat,    0, 0,    NULLCHAR,
  52.         NULLCHAR,
  53.     };
  54.     return subcmd(Udpcmds,argc,argv,p);
  55. }
  56.